(function(){

	angular.module('app').directive('addMonitor', ['addMonitorService',function (addMonitorService) {
		return {
			restrict: 'A',
			scope:{
				addMonitorConfig: '=',
				addMonitorType: '='
			},
			link: function (scope, iElement, iAttrs) {
				//scope.addMonitorConfig data
				//scope.addMonitorType  //监控的类型
				$(iElement).on('click',function(){
					// console.log('addMonitor click');
					addMonitorService.add(scope.addMonitorConfig,scope.addMonitorType);
				});

				scope.$on('$destroy',function(){
					$(iElement).off('click');
				});
			}
		};
	}]);
	
})();